//
//@File    :	12.1_strngbad.cpp
//@Time    :	2021/09/01 10:54:07
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	flawed string class definiton
//
#include <iostream>
#ifndef STRNGBAD_H_
#define STRNGBAD_H_

class StringBad
{
private:
    char * str; //pointer to string
    int len;     //length of string
    static int num_strings; //number of objects
    //静态类成员,无论创建了多少对象,都只创建一个静态类变量副本
    //类的所有对象共享同一个静态类成员
public:
    StringBad(const char * s);//constructor
    StringBad();              //default constructor
    ~StringBad();             //destrutor
//friend function
    friend std::ostream & operator<<(std::ostream & os,const StringBad & st);
};
#endif	// STRNGBAD_H_